#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n = 0;
    cin >> n;

    vector<int> nums(n);
    long long sum = 0, totalSum = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> nums[i];
        totalSum += nums[i];
    }

    for (int i = 0; i < n; i++)
    {
        totalSum -= nums[i];
        sum += (totalSum * nums[i]);
    }

    cout << sum << endl;
    return 0;
}